package com.example.demo.sys.mapper;

import com.example.demo.sys.entity.Coursecheckform;
import com.example.demo.sys.entity.Coursemanager;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 *  Mapper 接口 chrimer
 * </p>
 *
 * @author chrimer
 * @since 2020-06-28
 */
public interface CoursemanagerMapper extends BaseMapper<Coursemanager> {
    @Select("Select * from coursecheckform WHERE id=#{courseId}")
    List<Coursecheckform> SelectMycourse(String courseId);

    @Select("Select courseId from coursemanager WHERE userId=#{userId}")
    List<String> SelectCourseid(String userId);

    @Select("Select userId from coursemanager WHERE courseId=#{courseId}")
    List<String> SelectUserid(String courseId);

    @Select("Select score from studentwork WHERE courseId=#{courseId} and userId =#{userId}")
    List<Integer> SelectScore(String courseId,String userId);

    @Update("UPDATE coursemanager SET grade=#{scoreSum} WHERE userId=#{userId} and courseId = #{courseId}")
    void UpdateGrade(int scoreSum, String userId,String courseId);
}
